﻿<Window x:Class="Clock.Windows.WideFlipClock"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:Controls="clr-namespace:Clock.Controls"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Properties="clr-namespace:Clock.Properties"
        x:Name="this" Width="500" Height="275"
        FontFamily="/Home.Base;component/Fonts/#Droid Sans Mono" FontWeight="Light" Background="Transparent" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True"
        SourceInitialized="WindowSourceInitialized" Loaded="WindowLoaded" MouseMove="WindowMouseMove" MouseLeftButtonUp="WindowMouseLeftButtonUp" MouseEnter="ThisMouseEnter"
        MouseLeave="ThisMouseLeave">
    <Window.RenderTransform>
        <ScaleTransform x:Name="Scale" ScaleX="1" ScaleY="{Binding ElementName=Scale, Path=ScaleX}"/>
    </Window.RenderTransform>
    <Window.Resources>
        <Storyboard x:Key="ShowForecastAnim" Completed="ShowForecastAnimCompleted">
            <!--<DoubleAnimation Storyboard.TargetName="this" Storyboard.TargetProperty="Height" To="280" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3" FillBehavior="Stop"/>-->
            <!--<DoubleAnimation Storyboard.TargetName="ForecastGrid" Storyboard.TargetProperty="Height" To="100" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>-->
            <DoubleAnimation Storyboard.TargetName="ForecastGrid" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>
        </Storyboard>
        <Storyboard x:Key="HideForecastAnim" Completed="HideForecastAnimCompleted">
            <!--<DoubleAnimation Storyboard.TargetName="this" Storyboard.TargetProperty="Height" To="200" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3" FillBehavior="Stop"/>-->
            <!--<DoubleAnimation Storyboard.TargetName="ForecastGrid" Storyboard.TargetProperty="Height" To="0" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>-->
            <DoubleAnimation Storyboard.TargetName="ForecastGrid" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>
        </Storyboard>
        <Storyboard x:Key="MouseEnter">
            <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.3" FillBehavior="Stop" Completed="MouseEnterCompleted"/>
        </Storyboard>
        <Storyboard x:Key="MouseLeave">
            <DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" FillBehavior="Stop" Completed="MouseLeaveCompleted"/>
        </Storyboard>
    </Window.Resources>
    <Window.ContextMenu>
        <ContextMenu Opened="ContextMenuOpened">
            <MenuItem Name="DemoItem" Header="Demo" Visibility="Collapsed">
                <MenuItem Name="CloudsItem" Header="Clouds" Click="CloudsItemClick"/>
                <MenuItem Name="LightningItem" Header="Lightning" Click="LightningItemClick"/>
                <MenuItem Name="SnowItem" Header="Snow" Click="SnowItemClick"/>
                <MenuItem Name="RainItem" Header="Rain" Click="RainItemClick"/>
            </MenuItem>
            <MenuItem Name="RefreshItem" Header="{x:Static Properties:Resources.Refresh}" Click="RefreshItemClick"/>
            <MenuItem Name="ForecastItem" Header="{x:Static Properties:Resources.ShowForecast}" IsCheckable="True" Click="ForecastItemClick"/>
            <Separator />
            <MenuItem Name="PinItem" Header="{x:Static Properties:Resources.Pin}" IsCheckable="True" Click="PinItemClick"/>
            <MenuItem Name="TopMostItem" Header="{x:Static Properties:Resources.TopMost}" IsCheckable="True" Click="TopMostItemClick"/>
            <MenuItem Name="OptionsItem" Header="{x:Static Properties:Resources.OptionsItem}" Click="OptionsItemClick"/>
            <MenuItem Name="CloseItem" Header="{x:Static Properties:Resources.CloseItem}" Click="CloseItemClick"/>
        </ContextMenu>
    </Window.ContextMenu>
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo x:Name="Taskbar"/>
    </Window.TaskbarItemInfo>
    <Grid Margin="0,35,0,0">
        <Image Name="Bg" Source="/Clock;component/Resources/FlipClock/wide_base_default.png" Stretch="Fill" Height="140" VerticalAlignment="Top"/>
        <Rectangle Name="LightningBg1" Opacity="0" Fill="White" Height="130" RadiusX="7" RadiusY="7" Margin="6,5,6,0" VerticalAlignment="Top"/>
        <Rectangle Name="LightningBg2" Opacity="0" Fill="White"  Height="130" RadiusX="7" RadiusY="7" Margin="6,5,6,0" VerticalAlignment="Top"/>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="15,-20,0,0">
            <Controls:FlipTab x:Name="HoursTab" Delay="0.3" Margin="0,0,5,0"/>
            <Controls:FlipTab x:Name="MinutesTab" Delay="0.2" Speed="0.7"/>
        </StackPanel>
        <TextBlock Name="SetupLocationTextBlock" Foreground="White" Text="{x:Static Properties:Resources.SetupLocation}"  Margin="22,112,7,0" FontSize="14" TextWrapping="WrapWithOverflow" Visibility="Collapsed"/>
        <Grid Name="WeatherGrid">
            <TextBlock Name="DateTextBlock" Grid.ColumnSpan="3" Foreground="White" Text="вт, 22 мар" FontSize="16" Margin="22,112,0,5" HorizontalAlignment="Left">
                <TextBlock.Effect>
                    <DropShadowEffect Direction="135" ShadowDepth="1" BlurRadius="2" Opacity="0.6"/>
                </TextBlock.Effect>
            </TextBlock>
            <ProgressBar Name="WeatherRefreshProgressBar" Height="30" VerticalAlignment="Bottom" Margin="0,0,0,105" IsIndeterminate="True" Style="{StaticResource WeatherRefreshProgressBarStyle}"
                         Foreground="White" Visibility="Collapsed">
                <ProgressBar.OpacityMask>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <GradientStop Color="#00000000" Offset="0"/>
                        <GradientStop Color="#00000000" Offset="0.3"/>
                        <GradientStop Color="#FF000000" Offset="0.5"/>
                        <GradientStop Color="#00000000" Offset="0.7"/>
                        <GradientStop Color="#00000000" Offset="1"/>
                    </LinearGradientBrush>
                </ProgressBar.OpacityMask>
            </ProgressBar>
            <Grid VerticalAlignment="Top" HorizontalAlignment="Left" Margin="280,0,0,0" Width="210">
                <Image Name="WeatherIcon" Width="170" Height="170" Source="/UIFramework.Weather;Component/Images/weather_1.png"
                   ToolTip="{x:Static Properties:Resources.ShowForecastTooltip}" Cursor="Hand" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="30,-40,0,0"
                   MouseLeftButtonDown="WeatherIconMouseLeftButtonDown" MouseLeftButtonUp="WeatherIconMouseLeftButtonUp"/>
                <StackPanel Name="WeatherStackPanel" Orientation="Vertical" Margin="0,90,0,0" HorizontalAlignment="Left">
                    <StackPanel.Effect>
                        <DropShadowEffect Direction="315" ShadowDepth="1" BlurRadius="2" Opacity="0.6"/>
                    </StackPanel.Effect>
                    <TextBlock Name="LocationTextBlock" Foreground="White" Text="New York" FontSize="16" TextWrapping="WrapWithOverflow" MaxWidth="180" TextTrimming="CharacterEllipsis"/>
                    <TextBlock Name="WeatherTextBlock" Foreground="White" Text="Cloudy" FontSize="13" MaxWidth="180" MaxHeight="30" Margin="0,3,0,0" TextWrapping="WrapWithOverflow"/>
                </StackPanel>
                <TextBlock Name="TempTextBlock" Foreground="White" Text="1°" FontSize="38" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,0">
                    <TextBlock.Effect>
                        <DropShadowEffect Direction="315" ShadowDepth="1" BlurRadius="2" />
                    </TextBlock.Effect>
                </TextBlock>
                <StackPanel Name="WindSpeedPanel" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,50,0,0" Visibility="Collapsed">
                    <TextBlock Name="WindSpeedValueTextBlock" Foreground="White" Text="25 mph" FontSize="12">
                        <TextBlock.Effect>
                            <DropShadowEffect Direction="315" ShadowDepth="1" BlurRadius="2" />
                        </TextBlock.Effect>
                    </TextBlock>
                    <Image Name="WindSpeedIcon" Source="/UIFramework.Weather;Component/Images/wind_lvl1.png" Width="42" Height="36" Margin="0,-10,-1,0" RenderOptions.BitmapScalingMode="HighQuality" Stretch="Fill"/>
                </StackPanel>
                <StackPanel Name="HumidityPanel" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,50,0,0" Visibility="Collapsed">
                    <TextBlock Name="HumidityValueTextBlock" Foreground="White" Text="75%" FontSize="14">
                        <TextBlock.Effect>
                            <DropShadowEffect Direction="315" ShadowDepth="1" BlurRadius="2" />
                        </TextBlock.Effect>
                    </TextBlock>
                    <Image Name="HumidityIcon" Source="/UIFramework.Weather;Component/Images/humidity_lvl1.png" Width="16" Height="16" Margin="0,0,3,-10" RenderOptions.BitmapScalingMode="HighQuality"/>
                </StackPanel>
            </Grid>
        </Grid>
        <Grid Name="ForecastGrid" Opacity="0" Height="100" VerticalAlignment="Bottom"  Margin="8,0,8,0">
            <Image Source="/Clock;component/Resources/FlipClock/wide_forecast_base.png" Stretch="Fill" Height="72" Margin="-10,0,-10,0"/>
            <Grid Name="ForecastPanel" SnapsToDevicePixels="True" Margin="0,5,0,21">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="2"/>
                    <ColumnDefinition />
                    <ColumnDefinition Width="2"/>
                    <ColumnDefinition />
                    <ColumnDefinition Width="2"/>
                    <ColumnDefinition />
                    <ColumnDefinition Width="2"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Controls:WideForecastItem Cursor="Hand" Margin="0,0,3,0" Order="1"/>
                <StackPanel Grid.Column="1" Width="2" Orientation="Horizontal" Margin="0,26,0,10" Opacity="0.2">
                    <Rectangle Fill="Black" Width="1"/>
                    <Rectangle Fill="White" Width="1"/>
                </StackPanel>
                <Controls:WideForecastItem Grid.Column="2" Cursor="Hand" Margin="3,0,3,0" Order="3"/>
                <StackPanel Grid.Column="3" Width="2" Orientation="Horizontal" Margin="0,26,0,10" Opacity="0.2">
                    <Rectangle Fill="Black" Width="1"/>
                    <Rectangle Fill="White" Width="1"/>
                </StackPanel>
                <Controls:WideForecastItem Grid.Column="4" Cursor="Hand" Margin="3,0,3,0" Order="0"/>
                <StackPanel Grid.Column="5" Width="2" Orientation="Horizontal" Margin="0,26,0,10" Opacity="0.2">
                    <Rectangle Fill="Black" Width="1"/>
                    <Rectangle Fill="White" Width="1"/>
                </StackPanel>
                <Controls:WideForecastItem Grid.Column="6" Cursor="Hand" Margin="3,0,3,0" Order="4"/>
                <StackPanel Grid.Column="7" Width="2" Orientation="Horizontal" Margin="0,26,0,10" Opacity="0.2">
                    <Rectangle Fill="Black" Width="1"/>
                    <Rectangle Fill="White" Width="1"/>
                </StackPanel>
                <Controls:WideForecastItem Grid.Column="8" Cursor="Hand" Margin="3,0,3,0" Order="2"/>
            </Grid>
        </Grid>
        <Canvas Name="WeatherFxHost" Margin="0,0,0,0"/>
    </Grid>
</Window>
